package com.pdsu.graduation_design.views;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.annotation.NonNull;

import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.pdsu.graduation_design.R;

public class PaymentDialog extends BottomSheetDialog {

    private EditText passwordEditText;
    private Button confirmButton;


    public PaymentDialog(@NonNull Context context) {
        super(context);
        setContentView(R.layout.dialog_payment);

        passwordEditText = findViewById(R.id.password_edit_text);
        confirmButton = findViewById(R.id.confirm_button);

        confirmButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String password = passwordEditText.getText().toString();
                if (password.length() == 6) {
                    // 调用支付接口进行验证
                    Toast.makeText(getContext(),"支付成功",Toast.LENGTH_SHORT).show();
                    dismiss();


                } else {
                    Toast.makeText(getContext(), "请输入6位支付密码", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}